#include "StdAfx.h"
#include "SpendTimeHelper.h"
#include "Log.h"
CMap<CString,LPCTSTR,LONG,LONG&> mapTag;

CSpendTimeHelper::CSpendTimeHelper(void)
{
}


CSpendTimeHelper::~CSpendTimeHelper(void)
{
}

void CSpendTimeHelper::start(CString tag)
{
	long startTime = GetTickCount();
	mapTag.SetAt(tag,startTime);
}
void CSpendTimeHelper::end(CString tag)
{
	long start_time;
	mapTag.Lookup(tag,start_time);
	long cost = GetTickCount()-start_time;
	CString tmp;
	tmp.Format(L"%s cost %ld ms",tag,cost);
	CLog::WriteLog(tmp);
}